package com.wkh.cli.example;


import picocli.CommandLine;
import picocli.CommandLine.Option;

import java.util.concurrent.Callable;

/**
 * @author wkh
 */
public class Login implements Callable<Integer> {
    @Option(names = {"-u","--user"},description = "user name",interactive = true,arity = "0..1")
    String user;
    @Option(names = {"-p","--password"},description = "passPhrase",interactive = true,arity = "0..1")
    String password;

    @Option(names = {"-cp","--checkPassword"},description = "checkPassword",interactive = true,arity = "0..1")
    String checkPassword;
    /**
     * Computes a result, or throws an exception if unable to do so.
     *
     * @return computed result
     * @throws Exception if unable to compute a result
     */
    @Override
    public Integer call() throws Exception {
        System.out.println("user:"+user);
        System.out.println("password:"+password);
        System.out.println("checkPassword:"+checkPassword);
        return 0;
    }

    public static void main(String[] args) {
        new CommandLine(new Login()).execute("-u","123");
    }
}
